﻿using HCQ2_IBLL;
using HCQ2_Model.VLine.InputDto._0410;
using HCQ2_Model.VRDD.InputDto._20220620;
using HCQ2_Model.VRDD.OutputDto._20220620;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web;

namespace HCQ2_BLL
{
    public partial class T_VRAreaInfoBLL : IT_VRAreaInfoBLL
    {
        public List<OutputAreainfo> GetAreainfo(InputAreaInfo param)
        {
            return DBSession.IT_VRAreaInfoDAL.GetAreainfo(param);
        }
        /// <summary>
        ///  获取店铺详情
        /// </summary>
        /// <param name="param"></param>
        /// <param name="sotreType"></param>
        /// <param name="owner_id">创始人或合伙人id</param>
        /// <param name="user_id">登录人id</param>
        /// <returns></returns>
        public OutputGetStoreDetail GetStoreDetail(InputGetStoreDetail param, string sotreType, int owner_id, int user_id)
        {
            OutputGetStoreDetail storeDetail = DBSession.IT_VRAreaInfoDAL.GetStoreDetail(param, sotreType, owner_id,user_id);
            if (storeDetail == null)
                return null;
            //角色列表
            if (!string.IsNullOrEmpty(storeDetail.roleStr))
                storeDetail.roleList = new List<string>(storeDetail.roleStr.Split(','));
            //合伙人状态
            if (user_id == storeDetail.founder_id)
                storeDetail.partnerStatus = 100;
            else
            {
                var pCount = DBSession.IT_VRFounderApplyDAL.FindSingle(o => o.folder_id == param.folderID && o.user_id == user_id);
                if (pCount == null)
                    storeDetail.partnerStatus = -1;
                else
                    storeDetail.partnerStatus = pCount.apply_status;
            }
            List<folderType> storeType = DBSession.IT_VRAreaInfoDAL.GetstoreType(param.folderID);
            storeDetail.storeType = storeType;
            return storeDetail;
        }
    }
}